package org.lab.tracecash.web.rest.impl;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;

import org.lab.tracecash.common.model.SearchParams;
import org.lab.tracecash.common.model.SearchResults;
import org.lab.tracecash.model.User;
import org.lab.tracecash.web.rest.AbstractRestEntityService;

@Path("/user")
@Consumes({ "application/json; charset=UTF-8" })
@Produces({ "application/json; charset=UTF-8" })
public class UserRestService extends AbstractRestEntityService<User> {

	@GET
	@Path("/id/{id}")
	public User findById(@PathParam("id") Long id) {
		return super.findById(id);
	}

	/**
	 * 
	 * @param queryString
	 *            Expresion FIQL de busqueda
	 * @return
	 */
	@GET
	@Path("/find")
	public SearchResults<User> find(@QueryParam("q") String queryString) {
		SearchParams searchParams = new SearchParams().withQueryString(queryString);
		return find(searchParams);
	}

	@Override
	protected Class<User> getEntityClass() {
		return User.class;
	}
}
